/**
 * [DragonApp.view.notice.ImageGrid description]
 * 图库图像列表
 */
Ext.define('DragonApp.view.notice.ImageGrid', {
    extend: 'DragonApp.view.foundation.ImgAddGrid',

    alias: ['widget.imagegrid'],

    controller: 'noticeimagegrid',

    selModel: {
        selType: 'checkboxmodel'
    },
    plugins: [{
        ptype: 'gridfilters'
    }],
    requires: [
        'DragonApp.util.File',
        'DragonApp.util.String',
        'Ext.grid.filters.Filters',
        'DragonApp.store.JsonPTag',
        'DragonApp.view.notice.Bar',
        'DragonApp.store.ImageNotice',
        'Ext.overrides.locale.zh_CN.Filters',
        'DragonApp.view.notice.ImageController'
    ],
    dockedItems: [{
        xtype: 'notice-image-bar',
        dock: 'top'
    }],
    columns: [
        { text: '序号', xtype: 'rownumberer', width: 70, align: 'center' },
        { text: '文件名称', dataIndex: 'filename', width: 150, align: 'center', hideable: false },
        {
            text: '类型',
            dataIndex: 'ext',
            width: 100,
            align: 'center',
            hideable: false,
            filter: {
                type: 'list',
                options: ['jpg', 'png', 'gif']
            }
        },
        { text: '大小', dataIndex: 'filesize', width: 100, align: 'center', hideable: false, renderer: DragonApp.util.File.bytesToSize },
        { text: '宽度', dataIndex: 'width', width: 100, align: 'center', hideable: false, hidden: true },
        { text: '高度', dataIndex: 'height', width: 100, align: 'center', hideable: false, hidden: true },
        { text: '修改时间', dataIndex: 'lastmodtime', width: 145, align: 'center', hideable: false },
        { text: '文件路径', dataIndex: 'path', flex: 1, align: 'center', hideable: false, renderer: DragonApp.util.String.contentRender }
    ],

    store: {
        type: 'imageNotice',
        storeId: 'imageNoticeStore'
    },
    initComponent: function() {

        var me = this;
        me.callParent(arguments);

        var newBtn = me.queryById('new');
        var deleteColumn = me.queryById('delete');
        var batDeleteBtn = me.queryById('batdelete');
        //========
        //权限控制
        //========
        if ('查询用户' == sessionStorage.getItem("DragonApp_role_name")) {
            newBtn.hide();
            deleteColumn.hide();
            batDeleteBtn.hide();
        }
    }
});